#include "common.hpp"


int main()
{
    std::cout << "I am client" << std::endl;

    int wfd = open(PATH, O_WRONLY);

    std::string buffer;
    while(1)
    {
        printf("message # ");
        std::getline(std::cin, buffer);
        if ("quit" == buffer)
        {
            printf("client exit\n");
            break;
        }

        int n = write(wfd, buffer.c_str(), buffer.size());
        if (n != buffer.size())
        {
            std::cerr << "write error, " << "errno: " << errno << ", errorstring: " << strerror(errno) << std::endl;
            exit(-1);
        }
    }

    close(wfd);
    return 0;
}